package plugin

import (
	"Ahq/Models"
	"Ahq/ValiEngine"
)

type IntegerCalculation struct {
}

func (r *IntegerCalculation) GetName() string {
	return "整数计算"
}
func (r *IntegerCalculation) GetDesc() string {
	return "每一步计算结果均为整数"
}

func (r *IntegerCalculation) GetKey() string {
	return "IntegerCalculation"
}
func (r *IntegerCalculation) GetShow() bool {
	return true
}

func (r *IntegerCalculation) Vali(operator byte, operand1 int, operand2 int) bool {

	if operator == Models.Division && operand1%operand2 != 0 {
		return false
	}
	return true
}

func init() {
	ValiEngine.RegisterRule("IntegerCalculation", new(IntegerCalculation))
}
